import {
  DashboardOutlined,
  NodeExpandOutlined,
  BankOutlined,
} from '@ant-design/icons'
import withLoadable from '../utils/with-loadable'

// import Dashboard from "../views/dashboard"
// import Application from '../views/family/application'
// import Detail from '../views/family/detail'
// import StuInfo from '../views/family/stu-info'
// import Health from "../views/information/Health"
// import Survey from '../views/information/Survey'
// import Login from "../views/login"
// import NotFound from "../views/not-found"

const Dashboard = withLoadable(() => import('../views/dashboard'))
const Health = withLoadable(() =>
  import('../views/infomation/Health')
)
const Login = withLoadable(() => import('../views/login'))
const NotFound = withLoadable(() => import('../views/notFound'))
const Survey = withLoadable(() =>
  import('../views/infomation/Servey')
)
const Application = withLoadable(() =>
  import('../views/family/Application')
)
const Detail = withLoadable(() => import('../views/family/Detail'))
const StuInfo = withLoadable(() => import('../views/family/stu-info'))

// 白名单路由，不需要登录就能访问到的
const whiteList = [
  {
    path: '/login',
    component: Login,
  },
  {
    path: '/404',
    component: NotFound,
  },
]

// 需要登录后才能访问到的路由
const permissionRoutes = [
  {
    path: '/admin/dashboard',
    component: Dashboard,
    meta: {
      title: '仪表盘',
      icon: DashboardOutlined,
    },
  },
  {
    path: '/admin/infomation',
    redirect: '/admin/infomation/health',
    meta: {
      title: '信息提报',
      icon: NodeExpandOutlined,
    },
    children: [
      {
        path: '/admin/infomation/health',
        component: Health,
        meta: {
          title: '健康提报',
        },
      },
      {
        path: '/admin/infomation/survey',
        component: Survey,
        meta: {
          title: '问卷调查',
        },
      },
    ],
  },
  {
    path: '/admin/family',
    meta: {
      title: '家长中心',
      icon: BankOutlined,
    },
    redirect: '/admin/family/application',
    children: [
      {
        path: '/admin/family/application',
        component: Application,
        meta: {
          title: '病假申请',
        },
      },
      {
        path: '/admin/family/detail/:id',
        component: Detail,
        meta: {
          title: '申请详情',
          notInMenu: true, // 不在菜单显示
        },
      },
      {
        path: '/admin/family/stuinfo',
        component: StuInfo,
        meta: {
          title: '学生信息',
        },
      },
    ],
  },
]

export { whiteList, permissionRoutes }
